'''
Created on 08/04/2011

'''

def inst(txt, subtxt):                  #00
    i = 0                               #01
    derp = 0
    durp = 0
    for j in range(len(txt)):           #02
        derp = derp + 1
        if txt[j] == subtxt[i]:         #03
            i = i + 1                   #04
            durp = durp + 1
            if not i < len(subtxt):     #05
                return j - i + 1        #06
        else:                           #07
            i = 0                       #08
    print derp + durp
    return -1                           #09

#01 K
#02 n-1
